package com.alkaid.user.service;

import com.alkaid.commons.entity.User;
import com.alkaid.commons.ex.AuthorityInsertException;
import com.alkaid.commons.ex.UserInsertException;
import com.alkaid.commons.ex.UserNotFoundException;
import com.alkaid.commons.ex.UserUpdateException;
import com.alkaid.commons.param.user.ChangePasswordParam;

/**
 * The interface User service.
 *
 * @author Kylin
 */
public interface UserService {

    /**
     * 通过ID获取用户信息
     *
     * @param jwt the jwt
     * @return jwt token
     */
    User getUser(String jwt);

    /**
     * Reg.
     *
     * @param nickname the nickname
     * @param password the password
     * @param mobile   the mobile
     * @param smsCode  the sms code
     * @throws UserInsertException the user insert exception
     */
    void reg(String nickname, String password, String mobile, String smsCode) throws UserInsertException;

    /**
     * 修改用户信息
     *
     * @param jwt  the jwt
     * @param user 用户信息
     * @throws UserUpdateException 用户信息更新异常
     */
    void setUserInfo(String jwt, User user) throws UserUpdateException;

    /**
     * 检查昵称是否已存在
     *
     * @param nickname the nickname
     * @return the boolean
     */
    boolean checkNickname(String nickname);

    /**
     * 更改用户头像
     *
     * @param jwt    the jwt
     * @param avatar the avatar
     * @throws UserNotFoundException the user not found exception
     * @throws UserUpdateException   the user update exception
     */
    void setAvatar(String jwt, String avatar) throws UserNotFoundException, UserUpdateException;

    /**
     * 修改密码
     *
     * @param id    用户ID
     * @param param the param
     * @throws UserUpdateException the user update exception
     */
    void changePassword(Long id, ChangePasswordParam param) throws UserUpdateException;

    /**
     * 充值
     *
     * @param id the id
     * @return jwt
     * @throws AuthorityInsertException the authority insert exception
     */
    String pay(Long id) throws AuthorityInsertException;

}
